package com.huawei.bus.minitest.exe;

import org.json.JSONException;
import org.json.JSONObject;

import com.huawei.bus.minitest.constant.JSONConstant;

public class ExecuteFactory {
	
	public IExecute getExecute(JSONObject jsObj) throws JSONException
	{
		String type = jsObj.getString(JSONConstant.EXE_TYPE);
		if(JSONConstant.SQL_EXE_TYPE.equals(type)){
			return new SqlExecuteImpl(jsObj);
		}else if(JSONConstant.SOAP_EXE_TYPE.equals(type)){
			return new SoapExecuteImpl();
		}
		return null;
	}
	
	private static class ExecuteFactoryHolder{
		final static ExecuteFactory inst = new ExecuteFactory();
	}
	public static Object getInstance() {
		return ExecuteFactoryHolder.inst;
	}
	private ExecuteFactory(){};
}
